@extends('admin.layout.layout', ['row' => @$page])

@section('contain')

    <div class="portlet">
        <div class="portlet-title">
            <div class="caption">
                <x-portlet-breadcrumb :page="$page"></x-portlet-breadcrumb>
            </div>
            <div class="actions">

                @if(checkMethodsAuthority('distributor_create'))
                    <div class="item">
                        <a href="/{{ request()->path() }}/create" class="btn btn-primary">{{ ts('addnew') }}</a>
                    </div>
                @endif

            </div>
        </div>

        <div class="filter-wrapper">
            <form action="/{{ request()->path() }}/" class="form-inline filter-form">
                <div class=" input-group mb-3 custom-control-inline">
                    <input type="text" class="form-control s-input" name="value" value="{{ request()->input('value') }}" placeholder="{{ ts('dealerSEARCHTEXT') }}">
                </div>
                <div class="input-group mb-3 custom-control-inline">
                    <div class="input-group-prepend">
                        <span class="input-group-text">前台展示</span>
                    </div>
                    <select name="front_show" class="form-control">
                        <option value="">是否前台展示</option>
                        <option value="1" {{ request()->input('front_show') == '1' ? 'selected' : '' }}>是</option>
                        <option value="0" {{ request()->input('front_show') == '2' ? 'selected' : '' }}>否</option>
                    </select>
                </div>
                <div class="input-group mb-3 custom-control-inline">
                    <div class="input-group-prepend">
                        <span class="input-group-text">级别</span>
                    </div>
                    <select name="mdtype" class="form-control">
                        <option value="">请选择级别</option>

                        @foreach(range(1,5) as $v)
                            <option value="{{ $v }}" {{ request()->input('mdtype') == $v ? 'selected' : '' }}>{{ ts('mdtype'.$v) }}</option>
                        @endforeach
                    </select>
                </div>
                <div class="mb-3">
                    <button class="btn btn-primary">{{ ts('SEARCH') }}</button>
                    <a href="/{{ request()->path() }}/" class="btn btn-warning">{{ ts('RESET') }}</a>
                    @if(session('admin.user_type')==2)
                        <button type="button" class="btn btn-primary" onclick="tjMD('{{ session('admin.id') }}')">{{ ts('mdtj') }}</button>
                    @endif
                </div>

            </form>
        </div>
        <div>
            <div>
                <table class="table text-nowrap bt-table text-center table-bordered table-hover">
                    <thead>
                    <tr class="order_column text-center">
                        <th class="text-center">{{ ts('SELECT') }}</th>
                        <th data-column="id">{{ ts('sequence') }}</th>
                        <th data-column="abbr">店铺名称</th>
                        <th>级别</th>
                        <th data-column="first_name">{{ ts('CONTACTPERSON') }}</th>
                        <th data-column="phone_number">{{ ts('CONTACTINFORMATION') }}</th>
                        <th>是否前台展示</th>
                        <th>是否推荐</th>
                        <th style="width:270px">{{ ts('OPERATIONS') }}</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($data as $k => $v)
                        @if(session('hightlight') && session('hightlight.type')=='dealer' && session('hightlight.id')==$v->id)
                            <tr class="item-list table-warning">
                        @else
                            <tr class="item-list">
                                @endif
                                <td class="text-center">
                                    <input type="checkbox" class="roll_icheck icheck_input" name="ids[]" value="{{ $v->id }}">
                                </td>
                                <td>{{ @$data->firstItem()+$k }}</td>
                                <td>{{ @$v->abbr }}</td>
                                <th>{{  @ts('mdtype'.$v->mdtype) }}</th>
                                <td>{{ @$v->first_name }}</td>
                                <td>{{ rsPN(@$v->phone_number) }}</td>
                                <td>
                                    {{ $v->front_show == 1 ? '是' : '否' }}
                                </td>
                                <td>
                                    {{ $v->is_advanced == 1 ? '是' : '否' }}
                                </td>
                                <td  class="fixed-td text-center" style="width:270px">
                                    <a class="btn btn-success btn-sm" href='/admin/store/edit/{{ $v->id }}'>{{ ts('VIEW') }}</a>
                                    <a class="btn btn-primary btn-sm" onclick="handleDelete3('{{ $v->id }}', '店铺 {{ $v->abbr }}')">删除</a>
                                </td>
                            </tr>
                            @endforeach
                    </tbody>
                </table>
            </div>
            <div class="row my-3">
                <div class="col-auto">
                    <label style="cursor: pointer"><input type="checkbox" class="icheck_all" data-ele=".roll_icheck"><span class="ml-2">{{ ts('SELECTALL') }}</span></label>
                    <span class="btn btn-primary ml-3" onclick="deleteAlliCheck('.roll_icheck', '/admin/store/deletes')">{{ ts('delete') }}</span>
                </div>
                <div class="col">
                    {{ $data->appends(request()->input())->links() }}
                </div>
            </div>
        </div>

    </div>


@endsection

@section('script')
@endsection